package com.hula.onion.book.server.spider.platforms.guangzhouedai;

import com.hula.onion.book.server.common.LoginForm;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by work on 2018/3/13.
 */
@Component
public class GuangZhouEDaiSpiderHelper {
    /**
     * 组装请求参数
     *
     * @param form
     * @return
     */
    public Map<String, Object> installRequestParams(LoginForm form,String html){
        Document document= Jsoup.parse(html);
        String loginToken=document.select("[name=login_token]").attr("value");
        Map<String, Object> map = new HashMap<>(6);
        map.put("username", form.getUserName());
        map.put("password", form.getPassword());
        map.put("auth_code","");
        map.put("returnUrl","");
        map.put("userRole","1");
        map.put("login_token",loginToken);
        return map;

    }
}
